]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[AppSwitcher] add a workaround for a gjs problem with GdkModifierType
authorDan Winship <danw@gnome.org>
Tue, 6 Oct 2009 14:53:25 +0000 (10:53 -0400)
committerDan Winship <danw@gnome.org>
Tue, 6 Oct 2009 20:07:37 +0000 (16:07 -0400)
gdk_display_get_pointer() sometimes returns values for the mask that
aren't part of the GdkModifierType enumeration, which gjs doesn't like
(bug 597292). Work around that by adding a C wrapper that strips out
the extra flags.

https://bugzilla.gnome.org/show_bug.cgi?id=597559

js/ui/altTab.js
src/shell-global.c
src/shell-global.h

index 532c20a5be48e94481f74fe7b877f92d73366dd9..f3d3d6a1abba5dd7b1e70515640f014460e79827 100644 (file)
@@ -158,7 +158,7 @@ AltTabPopup.prototype = {
         // https://bugzilla.gnome.org/show_bug.cgi?id=596695 for
         // details.) So we check now. (Have to do this after calling
         // _updateSelection.)
-        let [screen, x, y, mods] = Gdk.Display.get_default().get_pointer();
+        let mods = global.get_modifier_keys();
         if (!(mods & Gdk.ModifierType.MOD1_MASK)) {
             this._finish();
             return false;
index 96e1c3c50ffa5375acb52e34685682a9684ab6fb..65688e7289b7de0a655ae29b8ddd71462208aa0b 100644 (file)
@@ -978,3 +978,23 @@ shell_global_get_focus_monitor (ShellGlobal  *global)
   meta_screen_get_monitor_geometry (screen, 0, &rect);
   return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);
 }
+
+/**
+ * shell_global_get_modifier_keys:
+ * @global: the #ShellGlobal
+ *
+ * Gets the current set of modifier keys that are pressed down;
+ * this is a wrapper around gdk_display_get_pointer() that strips
+ * out any un-declared modifier flags, to make gjs happy; see
+ * https://bugzilla.gnome.org/show_bug.cgi?id=597292.
+ *
+ * Return value: the current modifiers
+ */
+GdkModifierType
+shell_global_get_modifier_keys (ShellGlobal *global)
+{
+  GdkModifierType mods;
+
+  gdk_display_get_pointer (gdk_display_get_default (), NULL, NULL, NULL, &mods);
+  return mods & GDK_MODIFIER_MASK;
+}
index ca389ced17243ad4642710e38a8d64315ddf4d17..fe01aeb3d27f904b208683ec279835c912af2bf9 100644 (file)
@@ -77,6 +77,8 @@ GSList       *shell_global_get_monitors        (ShellGlobal  *global);
 GdkRectangle *shell_global_get_primary_monitor (ShellGlobal  *global);
 GdkRectangle *shell_global_get_focus_monitor   (ShellGlobal  *global);
 
+GdkModifierType shell_global_get_modifier_keys (ShellGlobal *global);
+
 G_END_DECLS
 
 #endif /* __SHELL_GLOBAL_H__ */